package com.self.campussecondhandmarket.enums;

/**
 * Author: Vincent
 * <p> DateTime: 2024/4/18 21:14
 * <p> Description: 订单状态枚举
 * <p>
 **/

public enum OrdersStatusEnum {
	NEW_ORDER_IS_PENDING_SHIPMENT("新下单待发货", 0),
	RECEIVED_FOR_EVALUATION("已收货待评价", 1),
	THE_ORDER_IS_COMPLETE("订单已完成", 2),
	THE_ORDER_HAS_BEEN_CANCELLED("订单已取消", -1);
	String desc;
	Integer status;
	
	OrdersStatusEnum(String desc, Integer status) {
		this.desc = desc;
		this.status = status;
	}
	
	public static String getValue(Integer status) {
		switch (status) {
			case 0:
				return NEW_ORDER_IS_PENDING_SHIPMENT.desc;
			case 1:
				return RECEIVED_FOR_EVALUATION.desc;
			case 2:
				return THE_ORDER_IS_COMPLETE.desc;
			case -1:
				return THE_ORDER_HAS_BEEN_CANCELLED.desc;
			default:
				return null;
		}
	}
	
	public static Integer getStatus(String desc) {
		switch (desc) {
			case "新下单待发货":
				return NEW_ORDER_IS_PENDING_SHIPMENT.status;
			case "已收货待评价":
				return RECEIVED_FOR_EVALUATION.status;
			case "订单已完成":
				return THE_ORDER_IS_COMPLETE.status;
			case "订单已取消":
				return THE_ORDER_HAS_BEEN_CANCELLED.status;
			}
		return null;
	}
}
